/*
 * @Date: 2023-03-14 13:55:52
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-14 14:18:12
 * @FilePath: \A19\backend\src\api\Get\ApiGetCourseInfo.ts
 */
import { ApiCall } from "tsrpc";
import { ReqGetCourseInfo, ResGetCourseInfo } from "../../shared/protocols/Get/PtlGetCourseInfo";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqGetCourseInfo, ResGetCourseInfo>) {
    // TODO
    const ret = await Global.collection('courses').findOne({
        _id:call.req.course
    })

    if(!ret) return call.error('不存在')

    call.succ({
        courseInfo:ret
    })
}